import java.util.LinkedList;

public class aaaa {
    
    public static void main(String[] args) {
        
        String str = "abcabcbb";

        int n = str.length();
        int[] index = new int[128];
        int maxLen = 0;
        int start = 0;

        for(int end=0; end <n; end++){

            start = Math.max(start, index[str.charAt(end)]);
            maxLen = Math.max(maxLen, end - start +1);
            index[str.charAt(end)] = end + 1;
        }

        System.out.println(maxLen);

    }
}
